
package com.myway.dto.ticket.domain;

import java.util.HashMap;

/**
 * 类名称：PaidNoTicketType <br/>
 * 类描述：支付未出票类型 <br/>
 * 创建时间：2015年11月23日 下午7:58:05 <br/>
 * @author Criss
 * @version V1.0
 */
public enum PaidNoTicketType {
	ORDER("O"), //订单 
	EXTBUY("E"), //补购订单
	CHANGE("C");//改升单

	/**
	 * Alias name. This is the name which will be stored in database.
	 */
	private final String alias;

	/**
	 * A hash map which keep all the sms status enum with alias name as key.
	 */
	private static HashMap<String, PaidNoTicketType> map;

	/**
	 * Construct the hash map at load time
	 */
	static {
		map = new HashMap<String, PaidNoTicketType>();
		for (PaidNoTicketType status : PaidNoTicketType.values()) {
			map.put(status.alias, status);
		}
	}

	PaidNoTicketType(String alias) {
		this.alias = alias;
	}

	@Override
	public String toString() {
		return this.alias;

	}

	public String getAlias() {
		return alias;
	}

	/**
	 * Return a <code>PaidNoTicketType</code> object holding the value of specified alias name
	 * 
	 * @param alias
	 *            the alias name of the status
	 * 
	 * @return a <code>PaidNoTicketType</code> object holding the value represented by the alias name
	 *         argument
	 */
	public static PaidNoTicketType valueOfAlias(String alias) {
		PaidNoTicketType status = map.get(alias);

		if (status == null) {
			throw new IllegalArgumentException("Unknown sms send status alias [" + alias + "]");
		}

		return status;
	}
}
